#include "QxAbstractDatabaseIO.hpp"

#include "QxDatabasePool.hpp"

QxAbstractDatabaseIO::QxAbstractDatabaseIO( const QSqlDatabase& database )
{
  m_database = database;
  connect( &theDatabasePool, SIGNAL( databaseChanged() ), this, SLOT( init() ) );
}

QxAbstractDatabaseIO::~QxAbstractDatabaseIO()
{
}

const QSqlDatabase& QxAbstractDatabaseIO::database() const
{
  return m_database;
}

void QxAbstractDatabaseIO::setDatabase( const QSqlDatabase& database )
{
  if( m_database.databaseName() != database.databaseName() ) {
    m_database = database;
    init();
  }
}